package com.woniuxy.rms.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * Auther: ChenGang  <br/>
 * Date: 2020/3/23 0023:下午 8:53  <br/>
 * Description:视图层配置类
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //默认首页为登录页面
        registry.addViewController("/login").setViewName("login/login");
        //跳转到菜单列表
        registry.addViewController("system/menuList").setViewName("system/menuList");
        //跳转到角色列表
        registry.addViewController("system/roleList").setViewName("system/roleList");
        //管理员角色编辑页面
        registry.addViewController("system/adminRole").setViewName("system/adminRole");
        //管理员列表
        registry.addViewController("system/adminList").setViewName("system/adminList");
        //跳转到角色添加页面
        registry.addViewController("system/addRole").setViewName("system/addRole");
        //跳转到动态列表
        registry.addViewController("dynamic/dynamicList").setViewName("dynamic/dynamicList");
        //跳转到权限列表
        registry.addViewController("system/permList").setViewName("system/permList");
        //跳转到权限添加页面
        registry.addViewController("system/addPerm").setViewName("system/addPerm");
        //跳转到动态评论列表
        registry.addViewController("dynamic/dynamicComment").setViewName("dynamic/dynamicComment");
        //跳转到服务评论
        registry.addViewController("server/serverComment").setViewName("server/serverComment");
        //跳转到活动评论
        registry.addViewController("hot/hotComment").setViewName("hot/hotComment");
        //跳转到商品评论
        registry.addViewController("goods/goodsComment").setViewName("goods/goodsComment");
        //服务列表
        registry.addViewController("server/serverList").setViewName("server/serverList");
        //入驻列表
        registry.addViewController("server/serverCheck").setViewName("server/serverCheck");
        //商品列表
        registry.addViewController("goods/goodsList").setViewName("goods/goodsList");
        //活动列表
        registry.addViewController("hot/hotList").setViewName("hot/hotList");
        //商品订单列表
        registry.addViewController("goods/goodsOrder").setViewName("goods/goodsOrder");
        //服务订单列表
        registry.addViewController("server/serverOrder").setViewName("server/serverOrder");
        //日志列表
        registry.addViewController("log/log").setViewName("log/log");
        //轮播列表
        registry.addViewController("carousel/carouselList").setViewName("carousel/carouselList");
        //添加轮播
        registry.addViewController("carousel/addCarousel").setViewName("carousel/addCarousel");
        //注册页面
        registry.addViewController("login/register").setViewName("login/register");
        //小区列表
        registry.addViewController("plot/plotList").setViewName("plot/plotList");
        //物业列表
        registry.addViewController("property/proList").setViewName("property/proList");
        //投诉列表
        registry.addViewController("complain/complainList").setViewName("complain/complainList");
        //密码重置
        registry.addViewController("system/changePwd").setViewName("system/changePwd");

    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //访问本地文件
        registry.addResourceHandler("img/server/**").addResourceLocations("file:D:/simplelife/img/server/");
        registry.addResourceHandler("img/carousel/**").addResourceLocations("file:D:/simplelife/img/carousel/");
    }
}